home *** CD-ROM | disk | FTP | other *** search
/ Languguage OS 2 / Languguage OS II Version 10-94 (Knowledge Media)(1994).ISO / gnu / ghspt261.gz / ghspt261 / gs261 / gpcheck.h < prev    next >
C/C++ Source or Header  |  1993-05-12  |  2KB  |  49 lines

  1. /* Copyright (C) 1992 Aladdin Enterprises.  All rights reserved.
  2.  
  3. This file is part of Ghostscript.
  4.  
  5. Ghostscript is distributed in the hope that it will be useful, but
  6. WITHOUT ANY WARRANTY.  No author or distributor accepts responsibility
  7. to anyone for the consequences of using it or for whether it serves any
  8. particular purpose or works at all, unless he says so in writing.  Refer
  9. to the Ghostscript General Public License for full details.
  10.  
  11. Everyone is granted permission to copy, modify and redistribute
  12. Ghostscript, but only under the conditions described in the Ghostscript
  13. General Public License.  A copy of this license is supposed to have been
  14. given to you along with Ghostscript so you can know your rights and
  15. responsibilities.  It should be in a file named COPYING.  Among other
  16. things, the copyright notice and this notice must be preserved on all
  17. copies.  */
  18.  
  19. /* gpcheck.h */
  20. /* Interrupt check interface for Ghostscript */
  21.  
  22. /*
  23.  * On some platforms, Ghostscript must check periodically for user-
  24.  * initiated actions.  (Eventually, this may be extended to all platforms,
  25.  * to handle multi-tasking within Ghostscript.)  Routines that run for
  26.  * a long time must periodically call gp_check_interrupts(), and if it
  27.  * returns true, must clean up whatever they are doing and return an
  28.  * e_interrupted (or gs_error_interrupted) exceptional condition.
  29.  * The return_if_interrupt macro provides a convenient way to do this.
  30.  *
  31.  * On platforms that require an interrupt check, the makefile defines
  32.  * a symbol CHECK_INTERRUPTS.  Currently this is only the Microsoft
  33.  * Windows platform.
  34.  */
  35.  
  36. #ifdef CHECK_INTERRUPTS
  37. extern int gp_check_interrupts(P0());
  38. #  define return_if_interrupt()\
  39.     if ( gp_check_interrupts() )\
  40.         return gs_error_interrupt
  41. #  define return_check_interrupt(code)\
  42.     return (code < 0 ? code : gp_check_interrupts() ? gs_error_interrupt : 0)
  43. #else
  44. #  define gp_check_interrupts() 0
  45. #  define return_if_interrupt() /* */
  46. #  define return_check_interrupt(code)\
  47.     return (code < 0 ? code : 0)
  48. #endif
  49.